import request from '@/utils/request'



// 管理员登录
export function login(data) {
  return request({
    url: '/admin/login',
    method: 'post',
    data
  })
}

// 获取用户总数
export function getUserTotal() {
  return request({
    url: '/user/total',
    method: 'get'
  })
}

export function getNewUsers() {
  return request({
    url: '/user/new',
    method: 'get'
  })
}

// 获取控制台数据
export function getDashboardData() {
  return request({
    url: '/admin/dashboard',
    method: 'get'
  })
}

// 帖子相关接口
export function getPosts(params) {
  return request({
    url: '/admin/posts',
    method: 'get',
    params
  })
}

export function deletePost(id) {
  return request({
    url: `/admin/posts/${id}`,
    method: 'delete'
  })
}

// 评论相关接口
export function getComments(params) {
  return request({
    url: '/admin/comments',
    method: 'get',
    params
  })
}

export function approveComment(id) {
  return request({
    url: `/admin/comments/${id}/approve`,
    method: 'put'
  })
}

export function rejectComment(id) {
  return request({
    url: `/admin/comments/${id}/reject`,
    method: 'put'
  })
}

export function deleteComment(id) {
  return request({
    url: `/admin/comments/${id}`,
    method: 'delete'
  })
}

// 用户相关接口
export function getUsers(params) {
  return request({
    url: '/admin/users',
    method: 'get',
    params
  })
}

export function blockUser(id, data) {
  return request({
    url: `/admin/users/${id}/block`,
    method: 'put',
    data
  })
}

export function unblockUser(id) {
  return request({
    url: `/admin/users/${id}/unblock`,
    method: 'put'
  })
}

// 获取封禁用户列表
export function getBlacklist(params) {
  return request({
    url: '/admin/blacklist',
    method: 'get',
    params
  })
}

// 审核相关接口
export function getPendingReviews(params) {
  return request({
    url: '/admin/review/pending',
    method: 'get',
    params
  })
}

export function getReviewedContent(params) {
  return request({
    url: '/admin/review/reviewed',
    method: 'get',
    params
  })
}

export function approveContent(id, data) {
  return request({
    url: `/admin/review/${id}/approve`,
    method: 'put',
    data
  })
}

export function rejectContent(id, data) {
  return request({
    url: `/admin/review/${id}/reject`,
    method: 'put',
    data
  })
} 